package grade;

public class ConsGrade extends ALoGrade {
	private GradeRecord first;
	private ALoGrade rest;

	public ConsGrade(GradeRecord first, ALoGrade rest) {
		this.first = first;
		this.rest = rest;
	}

	public String toString() {
		return this.first + " \n " + this.rest;
	}

	@Override
	public int howManyCredits() {

		return this.first.getCredits() + this.rest.howManyCredits();
	}

	@Override
	public double gardeAverage() {
		return this.tongdiem()/this.howManyCredits();
		
	}

	@Override
	public double tongdiem() {
		return this.first.getGrade()*this.first.getCredits()+this.rest.tongdiem();
	}

	@Override
	public ALoGrade greaterThanList(GradeRecord that) {
	
		return new ConsGrade(that, rest);
	}



}
